<?php

namespace App\Rules;

class ContractValidate extends BaseValidate
{
    //验证规则
    protected $rule = [
        'number' => 'required',
        'title' => 'required',
        'a_name' => 'required',
        'a_nick' => 'required',
        'b_nick' => 'required',
        'a_phone' => 'required',
        'b_name' => 'required',
        'b_phone' => 'required',
        'start_at' => 'required|date',
        'over_at' => 'required|date',
        'status' => 'required|integer',
        'area' => 'required',
    ];
    //自定义验证信息
    protected $message = [
        'a_nick.required' => '甲方联系人姓名不能为空',
        'b_nick.required' => '乙方联系人姓名不能为空',
        'a_name.required' => '合同甲方姓名不能为空',
        'b_name.required' => '合同乙方姓名不能为空',
        'number.required' => '合同编号不能为空',
        'title.required' => '合同标题不能为空',
        'start_at.required' => '合同生效日期不能为空',
        'over_at.required' => '合同失效日期不能为空',
        'start_at.date' => '合同生效日期不对',
        'over_at.date' => '合同失效日期不对',
        'status.required' => '合同状态请选择',
        'status.integer' => '合同状态不正确',
        'a_phone.required' => '合同甲方电话不能为空',
        'b_phone.required' => '合同乙方电话不能为空',
        'area.required' => '省份不能为空',
    ];

    //自定义场景
    protected $scene = [
//        'add' => "title,content",
//        'edit' => ['anchor_id', 'anchor_type_id'],
    ];
}
